//
//  ZLTableView.h
//  ZLTableView
//
//  Created by 赵振磊 on 2022/3/19.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

typedef NSInteger(^ZLSectionNumber)(void);
typedef NSInteger(^ZLRowNumber)(NSInteger section);
typedef CGFloat(^ZLCellHeight)(NSIndexPath *indexPath);
typedef UITableViewCell* _Nullable (^ZLIndexPathCell)(UITableView *tableview, NSIndexPath *indexPath);
typedef void(^ZLSelectCell)(NSIndexPath *indexPath);

/// section headview
typedef CGFloat(^ZLSectionHeaderFooterHeight)(NSInteger section);
typedef UIView* _Nullable(^ZLSectionHeader)(NSInteger section);
typedef UIView* _Nullable(^ZLSectionfooter)(NSInteger section);


@interface ZLTableView : UIView
/// 列表
@property (nonatomic, strong, readonly) UITableView *tableview;
/// 组数
@property (nonatomic, copy) ZLSectionNumber sectionNumber;
/// 行数
@property (nonatomic, copy) ZLRowNumber rowNumber;
/// cell高度
@property (nonatomic, copy) ZLCellHeight cellHeight;
/// cell
@property (nonatomic, copy) ZLIndexPathCell indexPathCell;
/// 点击cell
@property (nonatomic, copy) ZLSelectCell selectCell;
/// section header 高度
@property (nonatomic, copy) ZLSectionHeaderFooterHeight sectionHeaderHeight;
/// header
@property (nonatomic, copy) ZLSectionHeader sectionHeader;
/// section header 高度
@property (nonatomic, copy) ZLSectionHeaderFooterHeight sectionFooterHeight;
/// footer
@property (nonatomic, copy) ZLSectionfooter sectionFooter;

- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style;

/// 注册cell
- (void)registerCell:(NSArray<NSString *> *)cellNameArray;
- (void)registerCellNib:(NSArray<NSString *> *)nibNameArray;
/// 注册head、footer
- (void)registerHeaderFooter:(NSString *)viewClass;
- (void)registerHeaderFooterNib:(NSString *)nibViewClass;

- (void)sectionNumber:(ZLSectionNumber)sectionNumber
            rowNumber:(ZLRowNumber)rowNumber
           cellHeight:(ZLCellHeight)cellHeight
        indexPathCell:(ZLIndexPathCell)indexPathCell
           selectCell:(ZLSelectCell)selectCell;

- (void)sectionHeaderHeight:(ZLSectionHeaderFooterHeight)sectionHeaderHeight
          sectionHeaderView:(ZLSectionHeader)sectionHeaderView;
- (void)sectionFooterHeight:(ZLSectionHeaderFooterHeight)sectionFooterHeight
          sectionFooterView:(ZLSectionfooter)sectionFooterView;

/// 刷新
- (void)reloadData;

@end

NS_ASSUME_NONNULL_END
